package com.think.oauth.user.dao.user;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.think.oauth.user.model.UserOauth;

@Mapper
public interface UserOauthDao extends BaseMapper<UserOauth> {
	
	@Select("SELECT user_id,login_type,identifier,credential FROM think_oauth WHERE identifier='${identifier}' AND login_type=${loginType}")
	UserOauth selectUserOauthWithIDAndType(@Param("identifier") String identifier,@Param("loginType") Integer loginType);
	
	@Insert("INSERT INTO think_oauth (user_id,login_type,identifier,credential) "
			+ "VALUES (#{userId},#{loginType},#{identifier},#{credential})")
	public Integer insertNewRecord(UserOauth oauth);
}
